/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package sv.com.globalsolutionslt.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author karinaMelara
 */
@Entity
@Table(name = "locacion_geografica", catalog = "bolsadetrabajo", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "LocacionGeografica.findAll", query = "SELECT l FROM LocacionGeografica l"),
    @NamedQuery(name = "LocacionGeografica.findByIdLocacion", query = "SELECT l FROM LocacionGeografica l WHERE l.idLocacion = :idLocacion"),
    @NamedQuery(name = "LocacionGeografica.findByLatitud", query = "SELECT l FROM LocacionGeografica l WHERE l.latitud = :latitud"),
    @NamedQuery(name = "LocacionGeografica.findByLongitud", query = "SELECT l FROM LocacionGeografica l WHERE l.longitud = :longitud"),
    @NamedQuery(name = "LocacionGeografica.findByMostrarCordenadas", query = "SELECT l FROM LocacionGeografica l WHERE l.mostrarCordenadas = :mostrarCordenadas"),
    @NamedQuery(name = "LocacionGeografica.findByReferencia", query = "SELECT l FROM LocacionGeografica l WHERE l.referencia = :referencia")})
public class LocacionGeografica implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_locacion", nullable = false)
    private Integer idLocacion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(nullable = false, length = 20)
    private String latitud;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(nullable = false, length = 20)
    private String longitud;
    @Basic(optional = false)
    @NotNull
    @Column(name = "mostrar_cordenadas", nullable = false)
    private boolean mostrarCordenadas;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(nullable = false, length = 200)
    private String referencia;
    @JoinColumn(name = "id_publicacion", referencedColumnName = "id_publicacion", nullable = false)
    @ManyToOne(optional = false)
    private Publicacion idPublicacion;

    public LocacionGeografica() {
    }

    public LocacionGeografica(Integer idLocacion) {
        this.idLocacion = idLocacion;
    }

    public LocacionGeografica(Integer idLocacion, String latitud, String longitud, boolean mostrarCordenadas, String referencia) {
        this.idLocacion = idLocacion;
        this.latitud = latitud;
        this.longitud = longitud;
        this.mostrarCordenadas = mostrarCordenadas;
        this.referencia = referencia;
    }

    public Integer getIdLocacion() {
        return idLocacion;
    }

    public void setIdLocacion(Integer idLocacion) {
        this.idLocacion = idLocacion;
    }

    public String getLatitud() {
        return latitud;
    }

    public void setLatitud(String latitud) {
        this.latitud = latitud;
    }

    public String getLongitud() {
        return longitud;
    }

    public void setLongitud(String longitud) {
        this.longitud = longitud;
    }

    public boolean getMostrarCordenadas() {
        return mostrarCordenadas;
    }

    public void setMostrarCordenadas(boolean mostrarCordenadas) {
        this.mostrarCordenadas = mostrarCordenadas;
    }

    public String getReferencia() {
        return referencia;
    }

    public void setReferencia(String referencia) {
        this.referencia = referencia;
    }

    public Publicacion getIdPublicacion() {
        return idPublicacion;
    }

    public void setIdPublicacion(Publicacion idPublicacion) {
        this.idPublicacion = idPublicacion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLocacion != null ? idLocacion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LocacionGeografica)) {
            return false;
        }
        LocacionGeografica other = (LocacionGeografica) object;
        if ((this.idLocacion == null && other.idLocacion != null) || (this.idLocacion != null && !this.idLocacion.equals(other.idLocacion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sv.com.globalsolutionslt.entidades.LocacionGeografica[ idLocacion=" + idLocacion + " ]";
    }
    
}
